package sample.config;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class RabbitReceiver {

    @RabbitListener(queues = RabbitConst.DirectQueue)//监听的队列名称 TestDirectQueue
    public void processDirect(Map<String, String> testMessage) {
        System.out.println("DirectReceiver消费者收到消息  : " + testMessage.toString());
    }

    @RabbitListener(queues = RabbitConst.FanoutQueue)
    public void processFanout(Map<String, String> testMessage) {
        System.out.println("FanoutReceiver1消费者收到消息  : " + testMessage.toString());
    }

    @RabbitListener(queues = RabbitConst.FanoutQueue2)
    public void processFanout2(Map<String, String> testMessage) {
        System.out.println("FanoutReceiver2消费者收到消息  : " + testMessage.toString());
    }

    @RabbitListener(queues = RabbitConst.TopicQueueA)
    public void processTopicQueueA(Map<String, String> testMessage) {
        System.out.println("TopicQueueAReceiver消费者收到消息  : " + testMessage.toString());
    }

    @RabbitListener(queues = RabbitConst.TopicQueueB)
    public void processTopicQueueB(Map<String, String> testMessage) {
        System.out.println("TopicQueueBReceiver消费者收到消息  : " + testMessage.toString());
    }

}